<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Auth;

class AuthController extends Controller
{
	use AuthenticatesUsers;

    public function showLoginForm() {
    	return view('admin.auth.create');
    }


    public function username() {
    	return 'username';
    }


    protected function guard() {

    	return Auth::guard('admin');
    }

    protected function authenticated(Request $request, $user)
	{
		$user->update(['last_login_ip' => $request->ip(), 'last_login_time' => date('Y-m-d H:i:s')]);
	    return redirect()->intended('admin');
	}

	protected function loggedOut(Request $request) {
		return redirect()->route('admin.index');
	}
}
